package yf.mall.service;

import org.apache.ibatis.annotations.Param;
import yf.mall.entity.MallActEntity;
import com.yf.service.BaseService;
import yf.mall.entity.MallGoodsEntity;
import yf.mall.entity.MallOrderEntity;
import yf.mall.vo.ItemVo;
import yf.mall.vo.TicketVo;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 活动Service接口
 *
 * @author hxf
 * @email 505860922@qq.com
 * @date Mon Nov 25 13:53:21 CST 2019
 */
public interface MallActService extends BaseService<MallActEntity>{



    /**

     List<MallActVo> queryListVo(MallActVo mallActVo);

        MallActVo getVo(Long id);

     **/

   /***********BACK***********/



    /***********API***********/



    /**
     * 下单支付后 触发活动 给予对应的券 升级
     * @param orderEntity
     */
    void fire(MallOrderEntity orderEntity);

    /**
     * 回滚触发的活动 追回对应的券 取消升级 重制提货卡
     * @param orderEntity
     */
    void cancel(MallOrderEntity orderEntity);

    /**
     * 使用提货卡
     * @param code
     * @param userId
     */
    void useCard(MallOrderEntity orderEntity);

    /**
     * 获取卡片抵扣
     * @param orderEntity
     * @return
     */
    BigDecimal getCardPrice(MallOrderEntity orderEntity);


    /**
     * 使用券
     * @param orderEntity
     * @param cardPrice
     * @param recordId
     * @return
     */
    String useTicket(MallOrderEntity orderEntity, BigDecimal cardPrice, Long recordId);

    //提交订单活动验证
    void validateCommit(Long userId, String remark, ItemVo itemVo, List<? extends ItemVo> itemVos, Integer orderType, Long recordId);

    //后台转货发货验证
    void validateSend(ItemVo itemVo, Integer orderType, Long fromUserId, Long toUserId);

    MallActEntity findByName(String name);

    /***********COMMON***********/



    // 找出产品参与的活动
   MallActEntity findByGoodsIdAndstatus(Long goodsId,Integer status);

   // 找出产品券的信息 优惠券 换购券 积分
    TicketVo getTicketVo(Long goodsId);

    void deleteGoodsIdBatch( Long[] goods);

    List<MallActEntity> findByGoodsName(String goodsName,String actName,Integer status);

    //结算区域
    void fireAreaAct(String orderNo, String province, String city, String county, Integer quantity, Integer rewardType, Long userId, String reward, MallGoodsEntity goods);

    void untieAct(Long id,Integer status);

    List<MallActEntity> list(Map<String, Object> params);

    void autoUntieAct();
}
